package me.caofeng.util;

import java.util.UUID;

/**
 * Copyright © 2017曹峰. All rights reserved.
 *
 * @Prject: mall
 * @Package: me.caofeng.util
 * @Description: 使用 UUID来生成唯一字符串
 * @Author: 曹峰 blog.caofeng.me
 * @Date: 2017-06-16 0:16
 * @Version: V1.0
 */
public class UUIDUtil {

    /**
     * @Author:曹峰 blog.caofeng.me
     * @Date: 2017/6/16 0:18
     * @Description: 生成唯一随机字符串
     * @return 唯一的随机字符串
    */
    public static String generateUid() {
        return UUID.randomUUID().toString().replace("-","");
    }

    public static String generateOrderId(){
        return System.currentTimeMillis() + "" + (long) (Math.random() * 10000000L);
    }
    public static void main(String[] args){
        for ( int i =0 ; i < 100 ; i++ ){
            String orderId = generateOrderId();
            System.out.println(orderId);
            System.out.println(orderId.length());
        }
    }

}
